<include file="plugin/functions"/>
<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('plugin/index')}">{:lang('ADMIN_PLUGIN_INDEX')}</a></li>
        <li class="active"><a>{:lang('ADMIN_PLUGIN_SETTING')}</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('plugin/settingPost')}">
        <empty name="custom_config">
            {:_parse_plugin_config($data['config'])}
            <else/>
            <present name="custom_config">
                {$custom_config}
            </present>
        </empty>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input type="hidden" name="id" value="{$id}" readonly>
                <button type="submit" class="btn btn-primary js-ajax-submit" data-refresh="0">保存</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">返回</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    Wind.use('colorpicker',function(){
        $('.js-color').each(function () {
            var $this=$(this);
            $this.ColorPicker({
                livePreview:true,
                onChange: function(hsb, hex, rgb) {
                    $this.val('#'+hex);
                },
                onBeforeShow: function () {
                    $(this).ColorPickerSetColor(this.value);
                }
            });
        });

    });

    function doSelectLocation(obj) {
        var $obj       = $(obj);
        var title      = $obj.data('title');
        var $realInput = $obj;
        var location   = $realInput.val();

        parent.openIframeLayer(
            "{:url('dialog/map')}?location=" + location,
            title,
            {
                area: ['700px', '90%'],
                btn: ['确定', '取消'],
                yes: function (index, layero) {
                    var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                    var location  = iframeWin.confirm();
                    $realInput.val(location.lng + ',' + location.lat);
                    //$obj.val(location.address);
                    parent.layer.close(index); //如果设定了yes回调，需进行手工关闭
                }
            }
        );
    }
</script>
</body>
</html>